<template>
  <div>
    <div class="w">
      <div class="content">
        <div class="title">
          <i class="el-icon-s-promotion"></i>
          房产经纪
        </div>
        <ul class="list">
          <li v-for="item in agentList" :key="item.id">
            <router-link :to="'/list?agent='+item.id">
              <div class="left">
                <img :src="item.image" alt="" />
              </div>
              <div class="right">
                <h3>{{ item.name }}</h3>
                <p>{{ item.desc }}</p>
              </div>
            </router-link>
          </li>
        </ul>
      </div>
    </div>
  </div>
</template>

<script>
import { getAgents } from "@/api";
export default {
  data() {
    return {
      agentList: [],
    };
  },
  async created() {
    const { data } = await getAgents();
    this.agentList = data;
  },
  methods: {},
};
</script>

<style lang="less" scoped>
.content {
  .title {
    height: 50px;
    line-height: 50px;
    color: #ffa500;
    font-size: 20px;
  }
  .list > li {
    height: 200px;
    padding: 10px 0;
    border: 1px solid #ccc;
    margin-bottom: 15px;
    a {
      display: flex;
      height: 100%;
    }
    .left {
      height: 100%;
      width: 330px;
      text-align: center;
      border-right: 1px solid #ccc;
      img {
        width: 180px;
        height: 180px;
        margin-top: 10px;
        object-fit: cover;
      }
    }
    .right {
      flex: 1;
      text-align: center;
      h3 {
        height: 36px;
        line-height: 36px;
        font-size: 24px;
        font-weight: 700;
      }
      p {
        line-height: 1.5;
      }
    }
  }
}
</style>